package com.xiaoq.matrix.service.impl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;

import com.alibaba.dubbo.config.annotation.Service;
import com.xiaoq.apis.content.ContentInfo4Vo;
import com.xiaoq.apis.content.IContentApi;
import com.xiaoq.matrix.entity.ContentEntity;
import com.xiaoq.matrix.repository.IContentRepository;

@Service(interfaceClass=IContentApi.class, version="1.0.0")
public class ContentApiImpl implements IContentApi {
	
	@Autowired
	private IContentRepository contentRep;
	
	private static final Logger LOG = LoggerFactory.getLogger(ContentApiImpl.class);

	@Override
	public ContentInfo4Vo getContentInfo4Vo(String contentId) {
		ContentEntity content = contentRep.findContentEntity(contentId);
		ContentInfo4Vo contentInfo4Vo = null;
		if(content!=null){
			contentInfo4Vo = new ContentInfo4Vo();
			BeanUtils.copyProperties(content, contentInfo4Vo);
		}else{
			LOG.warn("ContentEntity: 查询结果为空！！");
		}
		
		
		return contentInfo4Vo;
	}

}
